<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title>我的资本资料</title>
    <script src="__STATIC__admin/js/jquery-1.7.2.min.js"></script>
    <link rel="stylesheet" href="__STATIC__layui/css/layui.css">
    <script src="__STATIC__layui/layui.js"></script>
    <style>
        .current-color {
            background-color: #009688;
        }

        .divide-line {
            height: 45px;
            background-color: #EEF5F9;
            font-style: italic;
            font-weight: 600;
            line-height: 45px;
            font-size: 17px;
            color: #1E88E5;
        }
        .divide-line span{
            margin-left: 15px;
        }

        .title-edit {
            display: block;
            font-size: 19px;
            font-weight: 700;
            margin-left: 5px;
            font-style: italic;
        }

        .psw-tip {
            /*display: none;*/
            height: 38px;
            width: 200px;
            line-height: 38px;
            font-style: italic;
            color: red;
        }

        .pic-main {
            height: 200px;
            width: 600px;
            position: absolute;
            left: 650px;
        }

        .pic-left {
            float: left;
            height: 100%;
            width: 280px;
        }

        .pic-center {
            float: left;
            height: 100%;
            width: 40px;
        }

        .pic-line {
            float: left;
            height: 100%;
            box-sizing: border-box;
            width: 20px;
            border-right: 1px solid #e1e2e5;
        }

        .pic-rigth {
            height: 100%;
            width: 280px;
            float: right;
        }
    </style>
</head>
<body class="layui-layout-body">
<script>
    //********获取省*******
    $.ajax({
        type: 'get',
        url: "{:url('admin/user/city')}",
        data: {type: 'province'},
        dataType: "json",
        success: function (data) {
            var res = data;
            var province = document.getElementById('province');
            for (var i in res) {
                var option = document.createElement('option');
                option.setAttribute('value', res[i].Pcode);
                option.innerText = res[i].Pname;
                province.appendChild(option);
            }
        },
    });

    // ******切换省，获取市*******
    layui.use('form', function () {
        var form = layui.form;
        //监听提交
        form.on('select(sheng)', function (data) {
            var pcode = data.value;
            $.ajax({
                type: 'get',
                url: "{:url('admin/user/city')}",
                data: {type: 'city', Pcode: pcode},
                dataType: "json",
                success: function (data) {
                    console.log(data)
                    $('#city').html('<option value="0">请选择一个城市</option>');
                    $('#county').html('<option value="0">请选择一个县/区</option>');
                    for (var i in data) {
                        var option = $('<option>');
                        option.attr('value', data[i].Ccode);
                        option.text(data[i].Cname);
                        $('#city').append(option);
                    }
                    form.render();
                }
            });
        });
    });
    // ******切换市，获取县*******
    layui.use('form', function () {
        var form = layui.form;
        //监听提交
        form.on('select(shi)', function (data) {
            var ccode = data.value;
            $.ajax({
                type: 'get',
                url: "{:url('admin/user/city')}",
                data: {type: 'county', Ccode: ccode},
                dataType: "json",
                success: function (data) {
                    console.log(data)
                    $('#county').html('<option value="0">请选择一个县/区</option>');
                    for (var i in data) {
                        var option = $('<option>');
                        option.attr('value', data[i].Acode);
                        option.text(data[i].Aname);
                        $('#county').append(option);
                    }
                    form.render();
                }
            });
        });
    });

</script>
<div class="layui-layout layui-layout-admin" style="background-color:#EEF5F9">
    <div class="layui-header">
        <div class="layui-logo"><img src="static/admin/Font_Icon/沐歌logo2.png" width="70" height="70"
        >后台管理系统</div>
        <!-- 头部区域（可配合layui已有的水平导航） -->
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item">
                <a href="javascript:;">
                    <img src="{$Think.session.admin['adminPic']}" class="layui-nav-img" alt="{$Think.session.admin['adminName']}">
                    {$Think.session.admin['adminName']}
                </a>
                <dl class="layui-nav-child">
                    <dd><a href="personaldata">基本资料</a></dd>
                </dl>
            </li>
            <li class="layui-nav-item"><a href="#" onclick="loginOut()">注销</a></li>
            <script>
                function loginOut() {
                    layer.confirm('你确定要注销吗？', {
                        btn: ['确定', '算了'] //按钮
                    }, function () {
                        layer.msg('注销成功', {icon: 1});
                        setTimeout(function () {
                            location.href ="loginout";
                        },1000)
                    });
                }
            </script>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <!-- 左侧导航区域（可配合layui已有的垂直导航） -->
            <ul class="layui-nav layui-nav-tree" lay-filter="test">
                <li class="layui-nav-item layui-nav-itemed">
                    <a class="" href="javascript:;">博客信息管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="{:url('admin/blog/blogList')}">博客列表</a></dd>
                        <dd><a href="{:url('admin/blog/blogAdd')}">添加博客</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">博客栏目管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="{:url('admin/category/categoryList')}">栏目列表</a></dd>
                        <dd><a href="{:url('admin/category/categoryAdd')}">添加栏目</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item layui-nav-itemed">
                    <a href="javascript:;">用户管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="{:url('admin/user/userList')}">用户列表</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">留言管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="{:url('admin/Comment/commentList')}">评论列表</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">友情链接管理</a>
                    <dl class="layui-nav-child">
                        <dd><a href="{:url('admin/link/linkList')}">友情链接列表</a></dd>
                        <dd><a href="{:url('admin/link/linkAdd')}">添加友情链接</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item">
                    <a href="javascript:;">数据恢复中心</a>
                    <dl class="layui-nav-child">
                        <dd><a href="{:url('admin/DataRecoveryCenter/recoveryBlogList')}">博文回收站</a></dd>
                        <dd><a href="{:url('admin/DataRecoveryCenter/recoveryBlogTypeList')}">栏目回收站</a></dd>
                        <dd><a href="{:url('admin/DataRecoveryCenter/recoveryUserList')}">用户回收站</a></dd>
                        <dd><a href="{:url('admin/DataRecoveryCenter/recoveryLinkList')}">友情链接回收站</a></dd>
                    </dl>
                </li>
                <li class="layui-nav-item"><a href="">待定</a></li>
            </ul>
        </div>
    </div>
    <div class="layui-body ">
        <!-- 内容主体区域 -->
        <!--        辅助线starting-->
        <div class="divide-line">
            <span>我的基本资料</span>
        </div>
        <!--        辅助线ending-->
        <!--   表单starting-->
        <form class="layui-form" enctype="multipart/form-data" action="{:url('admin/Login/doPersonalData')}" method="post" style="margin-left: 100px;margin-top:15px">
            <!--            照片starting-->
            <!--            表单令牌-->
            {:token('__token__', 'personaldata')}
            <div class="pic-main">
                <div class="pic-left">
                    <label>
                        <input type="file" style="position: absolute;opacity: 0" name="pic" ><br/>
                        <img STYLE="margin-top: -17px" src="__STATIC__admin/Font_Icon/上传图片.jpg" width="280" height="200"
                             alt="上传图片">
                    </label>
                </div>
                <div class="pic-center">
                    <div class="pic-line"></div>
                </div>
                <div class="pic-rigth">
                    <img style="border-radius: 100%" height="100%" width="280" src="{$Think.session.admin['adminPic']}"
                         alt="原图片">

                </div>
            </div>
            <!--            照片ending-->
            <div class="layui-form-item">
                <label class="layui-form-label">用户名</label>
                <div class="layui-input-inline">
                    <input type="text" name="uname" required lay-verify="required"
                           value="{$Think.session.admin['adminName']}"      autocomplete="off" class="layui-input"></div>
                <input type="hidden" name="adminid" value="{$Think.session.admin['adminid']}">
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">密码</label>
                <div class="layui-input-inline">
                    <input type="password" id="pwd" name="password" placeholder="请输入密码"
                           autocomplete="off" class="layui-input" value="{$Think.session.admin['password']}">
                </div>
            </div>
            <div class="layui-form-item" style="position: relative">
                <label class="layui-form-label">确认密码</label>
                <span class="psw-tip"></span>
                <div class="layui-input-inline" style="display: inline-block">
                    <input type="password" id="pwd-again" name="pwd_again"
                           placeholder="输入密码" autocomplete="off" class="layui-input"
                           value="{$Think.session.admin['password']}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">邮箱</label>
                <div class="layui-input-inline">
                    <input type="email" name="email" required  placeholder="请输入邮箱"
                           value="{$Think.session.admin['email']}"     autocomplete="off" class="layui-input">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">出生日期</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" name="birthdate" id="test1" placeholder="yyyy-MM-dd" value="{$Think.session.admin['birthdate']}">
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">性别</label>
                <div class="layui-input-block">
                    <input type="radio" name="gender" value="男" title="男" {if $Think.session.admin['adminGender']=="男"}
                    checked {/if}>
                    <input type="radio" name="gender" value="女" title="女" {if $Think.session.admin['adminGender']=="女"}
                    checked {/if}>
                </div>
            </div>
            <div class="layui-form-item">
                <label class="layui-form-label">上次登录IP</label>
                <div class="layui-input-inline">
                    <input type="text" class="layui-input" disabled value="{$Think.session.admin['last_IP']}"
                    style="border: white">
                </div>
            </div>
                <div class="layui-input-block">
                    <button class="layui-btn" lay-filter="go" id="btn">保存</button>
                </div>
        </form>
        <!--        验证两次密码输入是否正确starting-->
        <script>
            $(function () {
                $('#pwd-again').blur(function () {
                    if ($("#pwd").val() != $("#pwd-again").val()) {
                        $('.psw-tip').text('tip：两次密码输入不正确  !!!');
                    } else {
                        $('.psw-tip').text('');
                    }
                })
            });
            <!--        二次密码验证ending-->
        </script>


        <!-- 表单ending-->

        <!--  主体 ending     -->
    </div>
    <div class="layui-footer">
        <!-- 底部固定区域 -->
        © layui.com - 底部固定区域
    </div>
</div>

<script>
    //JavaScript代码区域
    layui.use('element', function () {
        var element = layui.element;
    });
    layui.use('laydate', function(){
        var laydate = layui.laydate;
        //常规用法
        laydate.render({
            elem: '#test1'
        });
    });

</script>
</body>
</html>
